package com.example.blogspring.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * @author : niu niu
 * @version : 1.0.0
 * @date : 2023/5/22 5:00
 */
@Configuration
public class AppConfig implements WebMvcConfigurer {
    List<String> list = Arrays.asList(
            "/user/login",
            "/**/*.html",
            "/js/**",
            "/css/**",
            "/pic/**",
            "/editormd/**",
            "/user/reg"

    );
    @Autowired
    LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns(list);
    }
}
